package com.minjiang.system.service.sec.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.minjiang.model.system.MyComment;
import com.minjiang.model.vo.MyCommentQueryVo;
import com.minjiang.system.service.sec.MyCommentService;
import com.minjiang.system.mapper.sec.MyCommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
* @author Administrator
* @description 针对表【my_comment(动态评论数据)】的数据库操作Service实现
* @createDate 2022-12-20 15:06:32
*/
@Service
public class MyCommentServiceImpl extends ServiceImpl<MyCommentMapper, MyComment>
    implements MyCommentService{
    @Autowired
    private MyCommentMapper myCommentMapper;
    @Override
    public IPage<MyComment> selectPage(Page<MyComment> pageParam, MyCommentQueryVo myCommentVo) {
        String title = myCommentVo.getKeyword();
        String createTimeBegin = myCommentVo.getCreateTimeBegin();
        String createTimeEnd = myCommentVo.getCreateTimeEnd();
        //封装参数
        QueryWrapper<MyComment> wrapper = new QueryWrapper<>();
        if(!StringUtils.isEmpty(title)) {
            wrapper.like("text",title);
        }
        //调用mapper方法实现分页条件查询
        IPage<MyComment> myCommentPage = myCommentMapper.selectPage(pageParam, wrapper);
        return myCommentPage;
    }
}




